Tuesday, December 30, 2008
Flag : "Animation"
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<math.h>
int x,y,angle=0;
void main()
{
  int gd=DETECT,gm;
  initgraph(&gd,&gm,"c:\\tcpp\\bgi");

 for(x=100,y=200;x<400;x++,angle++)
 {
 setfillstyle(SOLID_FILL,RED);
 bar(50,180,55,500); //flag rod

 setcolor(WHITE);

 y=200+15*sin(angle*3.14/180);
 line(x/2,0,x/2,500);delay(200);

 setcolor(LIGHTRED);
 line(x/2,y,x/2,y+15);

 setcolor(WHITE);
 line(x/2,y+15,x/2,y+30);

 setcolor(GREEN);
 line(x/2,y+30,x/2,y+45);

 setcolor(0);
 delay(2);

 if((x==399)&&(angle<1000))
 {
  x=100;angle=angle+5;//cleardevice();
 }

 }
 getch();
 getch();
 }